{% extends "base.html" %}

{% block content %}

<div id="custom-form" class="section">

<h3>New Library</h3>
<p>
The BookBurrito library database currently contains {{library_count}} entries.
You can help the BookBurrito project by adding configurations for your local library and enable other
members of your community to take advantage of BookBurrito.
</p>
<p>
We will periodically review contributed entries and when they pass validation, they will become
officially verified BookBorrito libraries.
</p>
{% if disabled_contributions %}
<form class="form" method="post">
<h4>Public Contributions Disabled - Sorry!</h4>
<div class="message">{{disabled_contributions}}</div>
</form>
{% else %}
<form class="form" method="post">

<div class="field">
<label for="custom-title">Library Title:
<span class="tip">Dislayed in the BookBurrito listing and used when searching.  E.g. "TX - Austin - Milwood Branch"</span>
</label>
<input id="custom-title" name="title" value="{{title}}" />
</div>

<div class="field">
<label for="custom-link">Link:
<span class="tip">URL to library catalog query <span id="contain-isbn">(must contain #{ISBN} replacement token)</span></span>
</label>
<input id="custom-link" name="link" value="{{link}}"/>
</div>

<div class="field">
<label>Query Results Interpretation:</label>
</div>

<div class="field">
<input type="radio" id="custom-match_missing" name="search_results" name="match_missing" style="width: auto"
{% if missing %}checked="checked"{% endif %} />
<label for="custom-match_missing" class="radio">
Missing Text
<span class="tip">Text returned by unsuccessful catalog query contains the following text:</span>
</label>
</div>

<div class="field" id="field-missing" style="padding-left: 1.5em; {% if not missing %}display: none;{% endif %}">
<input id="custom-missing" name="missing" value="{{missing}}" />
</div>

<div class="field">
<input type="radio" id="custom-match_isbn" name="search_results" name="match_isbn" style="width: auto"
{% if not missing %}checked="checked"{% endif %} />
<label for="custom-match_isbn" class="radio">
Match ISBN in results
<span class="tip">Text returned by successful catalog query contains the ISBN</span>
</label>
</div>

<div class="field">
<label for="custom-have">Existing Book:
<span class="tip">ISBN of a book that exists in the library catalog</span>
</label>
<input id="custom-have" name="have" value="{{have}}"/>
<div class="example" />
</div>

<div class="field">
<label for="custom-dont">Missing Book:
<span class="tip">ISBN of a book that does <b>not</b> exist in the library catalog</span>
</label>
<input id="custom-dont" name="dont" value="{{dont}}" />
<div class="example" />
</div>

<pre class="test-results hidden"></pre>

<div class="buttons">
<button id="custom-test">Test</button>
<button id="custom-preview" name="preview" value="preview">Preview</button>
</div>
</form>

{% endif %}

</div>


{% endblock %}

{% block html_body_end %}
<script src="/assets/js/sites.js"></script>
<script src="/assets/js/typewatch.js"></script>
<script src="/assets/js/isbn.js"></script>
<script src="/assets/js/edit-library.js"></script>
<script src="/assets/js/contribute.js"></script>
{% endblock %}